package com.easygem.common.model.front;

import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.wuwenze.poi.annotation.Excel;
import com.wuwenze.poi.annotation.ExcelField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.util.Date;
import java.util.List;

/**
 * @author luoxi
 * @version 1.0
 * @className CallLog
 * @Description TODO
 * @date 2025/2/18 15:55
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel("")
@Table(name = "`call_log`")
@Excel("通话记录")
public class CallLog {



    //客户名称
    @ExcelField(value = "客户名称", width = 150)//导出字段名
    @ApiModelProperty("客户名称")
    private String resourceName;
    //用户昵称
    @TableField(exist = false)
    @ExcelField(value = "用户昵称", width = 80)//导出字段名
    private transient String nickName;
    //部门名称
    @TableField(exist = false)
    @ExcelField(value = "部门名称", width = 80)//导出字段名
    private transient String deptName;


    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @ApiModelProperty("通话日志id")
    private Long logId;
    @Column(name = "`user_id`")
    @ApiModelProperty("用户id")
    private Long userId;
    @Column(name = "`sessionId`")
    @ApiModelProperty("话单唯一id")
    private String sessionId;
    @Column(name = "`bindNbr`")
    @ApiModelProperty("中间号")
    private String bindNbr;
    @Column(name = "`callerNbr`")
    @ApiModelProperty("主叫号码")
    @ExcelField(value = "主叫号码", width = 150)//导出字段
    private String callerNbr;
    @Column(name = "`calleeNbr`")
    @ApiModelProperty("被叫号码")
    @ExcelField(value = "被叫号码", width = 150)//导出字段
    private String calleeNbr;


    @Column(name = "`startTime`")
    @ApiModelProperty("被叫接通开始时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    private Date startTime;

    @Column(name = "`endTime`")
    @ApiModelProperty("话单结束时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    private Date endTime;

    @Column(name = "`callOutStartTime`")
    @ApiModelProperty("主叫接通时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    private Date callOutStartTime;

    @Column(name = "`secondsDuration`")
    @ApiModelProperty("通话时长（秒）")
    @ExcelField(value = "通话时长（秒）", width = 150)//导出字段
    private Integer secondsDuration;
    @Column(name = "`recordUrl`")
    @ApiModelProperty("录音地址")
    @ExcelField(value = "录音地址", width = 225)//导出字段
    private String recordUrl;
    @Column(name = "`status`")
    @ApiModelProperty("接通状态：2-未接通 1-已接通")
    private String status;
    @Column(name = "`ulFailReason`")
    @ApiModelProperty("结束状态：0-主叫挂断、1-被叫挂断、2-主叫放弃、3-被叫放弃、4-其他")
    private Integer ulFailReason;
    @Column(name = "`duration`")
    @ApiModelProperty("通话时长（分钟）")
    @ExcelField(value = "计费时长（分钟）", width = 150)//导出字段
    private Integer duration;
    @Column(name = "`circuit_tariff`")
    @ExcelField(value = "资费", width = 100)//导出字段名
    @ApiModelProperty("资费")
    private Double circuitTariff;
    @TableField(exist = false)
    private transient Double consumptionAmount;

    //归属部门
    @TableField(exist = false)
    private transient List<Long> ids;

    //用户id 用于用户昵称查询
    @TableField(exist = false)
    private transient String nickNameId;
    //部门Id 用于用户部门查询
    @TableField(exist = false)
    private transient String deptNameId;



    //最短时长
    @TableField(exist = false)
    private transient Integer minDuration;
    //最大时长
    @TableField(exist = false)
    private transient Integer maxDuration;


    //呼叫时间
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(exist = false)
    private transient Date startTime2;//开始时间
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(exist = false)
    private transient Date deadline;//截止时间

    //用户名
    @TableField(exist = false)
    private transient String userName;
    //用于坐席话务统计的批量导出
    @TableField(exist = false)
    private transient List<Long> userIds;
    //用户名
    @TableField(exist = false)
    private transient String accountName;

}
